home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 August / EnterCD 08_2005.iso / dosapps / freedos / doc / display / 204.txt next >
Encoding:
Text File  |  2003-09-14  |  10.1 KB  |  258 lines

  1. Expanding the hardware capabilities of DISPLAY/PRINTER
  2. ======================================================
  3.  
  4. FreeDOS DISPLAY.SYS and PRINTER.SYS have some routines which are dependant on
  5. the hardware type that they work on. This hardware is selected in the first
  6. parameter of the commandline.
  7. For example:
  8.  
  9.   DEVICE=C:\FDOS\DISPLAY.SYS  CON=(EGA,437,1)
  10.  
  11. specifies a hardware type "EGA".
  12.  
  13.  
  14. Currently, there are five hardware types implemented in DISPLAY.SYS, and none
  15. in PRINTER.SYS. The types in DISPLAY.SYS in fact refer to the same
  16. producedures, but define different "subfont" sizes, which helps you save some
  17. RAM. You can also do this specifying the number of subfonts (ready in DISPLAY
  18. 0.09, to come very soon). These will come ready on DISPLAY.SYS 0.09.
  19.  
  20. They are
  21.  
  22.   EGA        (automatic detection of number of subfonts, depending whether
  23.               you use EGA or VGA)
  24.  
  25.   EGA 8      (these two are equivalent to DISPLAY.SYS CON=(EGA,437,(1,1)) )
  26.   LCD
  27.  
  28.   EGA 14     (this is equivalent to  DISPLAY.SYS CON=(EGA,437,(1,2)) )
  29.  
  30.   VGA        (this is equivalent to  DISPLAY.SYS CON=(EGA,437,(1,3)) )
  31.  
  32.  
  33. The specific procedures for EGA, as well as the Int10h handler of DISPLAY.SYS,
  34. are the original code of DISPLAY by Ilya V. Vasilyev (all the other stuff is
  35. what I have added).
  36.  
  37. The notes below explain how to donate code to DISPLAY.SYS and PRINTER.SYS if
  38. you want to enlarge the capabilities with
  39.  
  40.  
  41.  
  42. How can I contribute a new hardware type?
  43. =========================================
  44.  
  45. In order to contribute a new type, the following structure is required:
  46.  
  47.     HwName     DB  "xxxxxxxx"
  48.     CPHwName   DB  "xxxxxxxx"
  49.     InitP      DW
  50.     InitParam  DW
  51.  
  52. HwName:     0-padded hardware name (such as "EGA") as it should appear in the
  53.             DISPLAY.SYS or PRINTER.SYS command line
  54. CPHwName:   space (#32)-padded name of the hardware to be identified in the
  55.             codepage entry header of the CPI files
  56. InitP:      Near pointer to the hardware device initialisation procedure
  57. InitParam:  A param to be passed to the previous procedure, so that the same
  58.             procedure can be used for different table entries
  59.  
  60.  
  61. Appart from the table, you need to create three procedures:
  62.  
  63. HWInit    (NON-RESIDENT)
  64.           A procedure to be executed when DISPLAY is loaded, that detects the
  65.           hardware and initialises the required data
  66. SwSelect  (RESIDENT)
  67.           A procedure to load certain codepage whose data resides in certain
  68.           buffer supplied by the core component
  69. HwSelect  (RESIDENT)
  70.           A procedure to load certain codepage whose data is determined by
  71.           hardware
  72.  
  73. Please send to me two files, written in NASM language, and please use no names
  74. for each field in the table, and a specific name for each procedure. A first
  75. file should contain the table above filled as appropriate, and the HWInit
  76. procedure. The second file should contain the two resident procedures (and any
  77. other resident procedure or variable that is required).
  78.  
  79.  
  80.  
  81. What procedures can I call?
  82. ===========================
  83.  
  84. Respect to procedures, in HwInit you can use ANY procedure throuhgout the file.
  85. In particular, you may find useful to use these:
  86.  
  87. OutStrDX:  write a string (which ends in '$').
  88.   IN:  DX: near address of the '$'-terminated string
  89.   OUT: -
  90.  
  91. WriteNumber:  writes a number in decimal
  92.   IN:  AX: a number under 1000 to be displayed (3 digits at most)
  93.   OUT: -
  94.   NOTES:  the "SyntaxErrorStr" string space is reused, and this string can no
  95.           longer be used after this procedure is called
  96.  
  97.  
  98. In the resident routines, you can only call resident procedures (there's 
  99. nothing else interesting in the driver that you may want to call).
  100.  
  101. In DISPLAY.SYS ONLY: you should make calls to the old Int10h handler by using
  102.  
  103.           call    FAR [cs:dOld10]
  104.  
  105. Of course, you can call any resident routine from HwInit, but the converse is
  106. not true.
  107.  
  108.  
  109.  
  110. What variables can/should I use?
  111. ================================
  112.  
  113. When designing your routines, there is a number of variables that you can use,
  114. and even a number of variables that you are expected to fill. See the table
  115. below.
  116.  
  117.   Flags of the variable
  118.   ---------------------
  119.   FLAG   Meaning
  120.   ------------------------------------------------------------------------
  121.   +      You should mandatorily fill in this variable in HwInit with the
  122.          appropriate value, or else DISPLAY/PRINTER will not work
  123.   *      Non-resident variables that you can optionally fill in, if the
  124.          information is available
  125.   &      Resident variable that you can ONLY write on the HwInit procedure
  126.          (but not in the resident routines)
  127.   ------------------------------------------------------------------------
  128.  
  129.  
  130. Useable variables
  131. --------------------------------------------------------------------------
  132. VarName          Flag  Type  Meaning
  133. --------------------------------------------------------------------------
  134. pRefreshHWcp      +    WORD  Near pointer to the software codepage
  135.                              selection routine
  136. pRefreshSWcp      +    WORD  Near pointer to the hardware codepage
  137.                              selection routine
  138. wMinFontSize      *    WORD  (DISPLAY.SYS ONLY) minimum number of subfonts
  139.                              that DISPLAY.SYS should admit. If the user
  140.                              specifies less than this value, then user's
  141.                              option will be ignored, and this variable will
  142.                              be used
  143. bMaxHWcpNumber    *    BYTE  Maximum number of hardware hardcoded codepages
  144. bAdapter          +    BYTE  (DISPLAY.SYS ONLY) Adapter type (or compatible),
  145.                              which is used by the DISPLAY int10h handler in
  146.                              order to provide the appropriate font info (for
  147.                              example, does not offer the 8x16 font if adapter
  148.                              is NOT VGA). See the constants below
  149. wTableSize        +    WORD  (PRINTER.SYS ONLY) This variable exists in both
  150.                              drivers, but you only have to fill in it in
  151.                              PRINTER.SYS. As in PRINTER there are no subfonts,
  152.                              you have to specify a maximum size of the font
  153.                              info, so that PRINTER can reserve required RAM
  154.                              buffers of the correct size to store the font
  155.                              info.
  156.                              DISPLAY will automatically override any value
  157.                              you give with a value based on the number of
  158.                              subfonts.
  159. wHardCPs          &    WORD  You can specify here ONE default hardware
  160.                              codepage for the device on startup (but leave it
  161.                              0 if it is unknown) 
  162. --------------------------------------------------------------------------
  163.  
  164.  
  165. Adapter type constants  (for bAdapter)
  166. ----------------------
  167. Adapter type    Value
  168. ---------------------
  169. NO               0
  170. MDA              2
  171. HGA              4
  172. CGA              6
  173. EGA              8
  174. MCGA            10
  175. VGA             12
  176. VESA            14
  177.  
  178.  
  179.  
  180.  
  181. What are the interfaces to the procedures?
  182. ==========================================
  183.  
  184. In this section it is described the interfaces of each of the three
  185. procedures, and the registers they may use. Please note that there's
  186. quite a few of stack space remaining, so you shouldn't abuse the stack.
  187.  
  188.  
  189. HwInit
  190. ------
  191. Detects the hardware device, initialises the device and some variables.
  192.   IN:  AX: the parameter stored in the device structure above
  193.   OUT: CFlag=0  on success
  194.        CFlag=1  on failure, if the device was not found, or couldn't be
  195.                 initialised. In such case:
  196.                 DX: near pointer to a string explaining the error (and
  197.                     ending in '$')
  198.   REGISTERS:  You must preserve SI if you use it, but can use the other
  199.               registers freely (except SS, SP, BP)
  200.  
  201. RefreshHWcp
  202. -----------
  203. Refreshes certain hardware (hardcoded) codepage, if possible
  204.   IN:  CX: the number of hardware codepage to be restored, starting on 0
  205.   OUT: CFlag set on error, clear on success
  206.   REGISTERS: AX,CX,DS,ES,DI can be freely used, the others must be
  207.              preserved
  208.  
  209.  
  210. RefreshSWcp
  211. -----------
  212. Sets a user defined codepage from user loaded font info
  213.   IN:  AL: screen mode (as set by the functions ah=00h, ax=4f02h of the
  214.            interrupt 10h), -1 if mode is unknown
  215.   OUT: CFlag set on error, clear on success
  216.   REGISTERS: AX,CX,DS,ES,DI can be freely used, the others must be
  217.              preserved
  218.   NOTE: The font information about the font to be set is stored in
  219.         the following variables, that must be used:
  220.              bFont8x8:    times 2048 DB      ; space for the 8x8 font
  221.              bFont8x14:   times 3584 DB      ; space for the 8x14 font
  222.              bFont8x16:   times 4096 DB      ; space for the 8x16 font
  223.  
  224.  
  225.  
  226. when are these routines to be inserted?
  227. =======================================
  228.  
  229. When you have them ready, please mail them to me to (aitorsm -AT- inicia.es),
  230. and they will be launched with the next version of DISPLAY.SYS and PRINTER.SYS
  231. starting on version 0.09, which at the moment in which these notes are
  232. written, is not yet ready.
  233.  
  234.  
  235.  
  236. are you going to write more of these routines?
  237. ==============================================
  238.  
  239. Personally I am fully satisfied with having support for EGA/VGA displays, and
  240. am not planning to write any more hardware support, although you can easily
  241. write your own routines, that can be easily attached to the current
  242. DISPLAY/PRINTER scheme.
  243.  
  244. However, as there's no PRINTER.SYS hardware management routine, I would
  245. consider writing one for PRINTER.SYS *provided that*:
  246. (a) You plan to use it, and you can show you really need it
  247. (b) You have CPI fonts to use with it
  248. (c) Someone (maybe me, maybe you) has enough technical information about
  249.     the routines, because I have very little information about it...
  250.  
  251.  
  252. ===================
  253.   Aitor SANTAMARIA MERINO
  254.   The FreeDOS Project, 7th of AUGUST, 2003
  255.  
  256. Version 1.1: 15th of September, 2003
  257.   (thanks to Martin Stromberg)
  258.